<template>
  <div>
    <el-card shadow="never" class="mb20">
      <record-form ref="recordForm" @search="handleSearch" />
    </el-card>
    <el-card shadow="never">
      <record-table @deal="handleDeal" @detail="handleDetail" @edit="handleEdit" ref="recordTable" />
    </el-card>
    <record-modal ref="recordModal" @refresh="handleRefresh" />
    <record-detail ref="recordDetail" />
    <record-handle @refresh="handleRefresh" ref="recordHandle" />
  </div>
</template>

<script>
import RecordForm from './RecordForm'
import RecordTable from './RecordTable'
import RecordModal from './RecordModal'
import RecordDetail from './RecordDetail'
import RecordHandle from './RecordHandle'

export default {
  components: {
    RecordForm,
    RecordTable,
    RecordModal,
    RecordDetail,
    RecordHandle
  },
  methods: {
    handleSearch(queryParam) {
      this.$refs.recordTable.handleGetList(queryParam)
    },
    handleRefresh() {
      this.$refs.recordTable.handleGetList()
    },
    handleEdit(bool, obj, view = false) {
      this.$refs.recordModal.edit(bool, obj, view)
    },
    // 处置
    handleDeal(row) {
      this.$refs.recordHandle.edit(row)
    },
    // 详情
    handleDetail(row) {
      this.$refs.recordDetail.edit(row)
    }
  }
}
</script>
